1. Field of the Invention
The present invention relates to a method of controlling the writing and erasing of information in flash memories and the like used as an external storage device for personal computers. This type of memory is incapable of having information written over existing information.
2. Description of the Prior Art
In recent years, there has been wide attention on external storage devices which use flash memory. The flash memory does not require a backup power supply because of its non-volatile characteristic, can be rewritten electrically, and, also, is inexpensive. However, the flash memory has shortcomings as follows.
First, it is impossible to write information over existing information. Also, it is impossible to erase information by the unit of byte, but possible by the unit of sector, block, or chip. Thus, a rewrite can not be done byte by byte as in the conventional memory so that the rewriting speed as well as the erasing speed is relatively slow compared to the reading speed.
Second, there is a limit in the number of erasures that the flash memory can tolerate, and a typical flash memory can not be used after a hundred thousand to one million erasures. Thus, areas which experience a larger number of erasures become defective faster than other areas so that the total area available for storing information decreases unless the number of erasures are roughly averaged across all the sectors or all the blocks, whichever is used as the unit of erasing.
Since the flash memory has shortcomings as listed above, various counter measures should be taken in using the flash memory, which range from preparing an evacuation area and evacuating data at the time of rewriting, providing a control table for controlling the writing and erasing of information, to preparing a way to save the situation when defective sectors or defective blocks are generated.
As described above, the flash memory has such advantages as a non-volatile characteristic and electrical rewrite capability, but also has many inadequacies as well, so that those inadequacies must be surmounted before using it for a practical purpose.
Accordingly, there is a need in the flash memory field for a method of writing, erasing, and controlling a memory so that those shortcomings are obviated to facilitate use of flash memory for practical purposes.
Accordingly, it is a general object of the present invention to provide a method of writing, erasing, and controlling a flash memory, which method satisfies the need described above.
It is another and more specific object of the present invention to provide an efficient method of writing, erasing, and controlling a memory for a memory device whose memory can not write information over existing information and can not erase information by the unit of byte.
It is yet another object of the present invention to provide a method of writing, erasing, and controlling the memory, which method can average the numbers of erasures all over the memory area.
In order to achieve those objects, a method of writing and erasing data in a memory device with a memory area having a plurality of blocks each with a plurality of sectors, with the memory device erasing data by the unit of one block, comprises the steps of selecting a first predetermined number of blocks from a top of a first list in which the blocks are ranked in a descending order of a number of necessary sectors in each of the blocks, selecting a second predetermined number of blocks from a top of a second list in which the blocks are ranked in a ascending order of a number of necessary sectors in each of the blocks, and evacuating the necessary sectors from the first predetermined number of blocks and a second predetermined number of blocks to other blocks which have free sectors.
It is still another object of the present invention to provide a method of writing, erasing, and controlling the memory, which method can increase its writing speed.
In order to achieve this object, a management method of writing data in a memory device with a memory area having a plurality of sectors unable to be overwritten, with a memory device erasing data by the unit of one sector, comprises the steps of providing at least two sectors for each sector number, writing data into one of the two sectors, the noted one being a free, and erasing data in the other sector of the two sectors simultaneously with the step of writing data, if there is data in the other sector.
It is a further object of the present invention to provide a method of writing, erasing, and controlling the memory, by a method which can increase the reliability of the memory management.
It is a yet further object of the present invention to provide a method of writing, erasing, and controlling the memory, by a method which can provide a counter measure when defective areas are generated.
In order to achieve those objects, a method of managing a memory device with a memory area having a possibility that part of the memory area is destroyed, and having a decoder able to be rewritten for indicating locations where data is stored in the memory area, comprises the steps of arranging two decoders in a series to form the decoder, and rewriting at least one of the two decoders when part of the memory area or part of the two decoders is destroyed, so that this part of the memory area or this part of the two decoders is not accessed.